package utilities;

/**
 * World state implementing the environment state.
 * @author pcdejager
 */
public final class WorldState implements EnvironmentState {
    /**
     * Constructor.
     */
    private WorldState() {
        now = new WorldDate();
    }
    /**
     * Return now.
     * @return Now
     */
    public WorldDate now() {
        return now;
    }
    /**
     * Move to the next day.
     */
    public void nextDay() {
        now.addDays(1);
    }
    /**
     * Move to the next year.
     */
    public void nextYear() {
        now.addYears(1);
    }
    /**
     * Now.
     */
    private WorldDate now;

    /**
     * Get the state singleton.
     * @return The state
     */
    public static WorldState getState() {
        if (state == null) {
            state = new WorldState();
        }
        return state;
    }
    /**
     * Reset the state.
     */
    public static void reset() {
        state = new WorldState();
    }
    /**
     * The state singleton.
     */
    private static WorldState state = null;
}
